
### This code plots Figure 4 bootstrap test results
### Estimates for bootstrap simulations done in parallel on Tukey in simulation.R

setwd("~/Documents/working/separated_emIRT/binIRT")
load("bs_simulation.1.RData")

bse.obs.all <- bse.obs
idealpt.obs.all <- idealpts.obs

for(i in 2:40){
  load(paste("bs_simulation", 2, "RData", sep="."))
  bse.obs.all <- cbind(bse.obs.all, bse.obs)
  idealpt.obs.all <- cbind(idealpt.obs.all,idealpts.obs)
}


pdf("pcvote_vs_SD.pdf")
par(mar=c(5, 5, 4, 2) + 0.1)
diff <- apply(bse.obs.all,1,mean) - apply(idealpt.obs.all,1,sd)
plot(1-pc.vote,diff, cex.lab=1.7, cex.axis=1.5,
	xlab="Missing data as fraction of total votes cast",
	ylab="Bias of standard error")
abline(h=0)
dev.off()


pdf("idealpt_vs_SD.pdf")
par(mar=c(5, 5, 4, 2) + 0.1)
plot(idealpt.true,diff, cex.lab=1.7, cex.axis=1.5,
	xlab="True ideal point",
	ylab="Bias of standard error")
abline(h=0)
dev.off()

